package org.springblade.modules.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;

import org.springblade.modules.admin.dto.ByScoreQuestionAppealSearchDTO;
import org.springblade.modules.admin.entity.MaintainByScoreQuestionAppeal;
import org.springblade.modules.admin.mapper.MaintainByScoreQuestionAppealMapper;
import org.springblade.modules.admin.service.ByScoreQuestionAppealService;
import org.springblade.modules.admin.vo.ByScoreQuestionAppealPageVO;
import org.springblade.modules.admin.vo.PlanAbarbeitungByContentVO;
import org.springframework.stereotype.Service;

import java.util.List;

@AllArgsConstructor
@Service
public class ByScoreQuestionAppealServiceImpl extends BaseServiceImpl<MaintainByScoreQuestionAppealMapper, MaintainByScoreQuestionAppeal> implements ByScoreQuestionAppealService {

	@Override
	public IPage<ByScoreQuestionAppealPageVO> selectPage(IPage<ByScoreQuestionAppealPageVO> page, ByScoreQuestionAppealSearchDTO searchDTO) {
		return page.setRecords(baseMapper.page(page,searchDTO));
	}

	@Override
	public List<PlanAbarbeitungByContentVO> selectDetail(Long id) {
		MaintainByScoreQuestionAppeal entity = super.getById(id);
		if(Func.isEmpty(entity)){
			throw new ServiceException("业务数据不存在");
		}
		return baseMapper.selectistoryList(entity.getPlanId(),entity.getAppealStatus());
	}

}
